<?php
	class m_template extends spModel
	{
		function select_template($dir = '')
		{
			if(!$id) $id = $name;
			$templatedir = $dir ? APP_PATH.'/tpl/'.$dir.'/' : APP_PATH.'/tpl/';
			$files = array_map('basename', glob($templatedir.$pre.'*.html'));
			$templates = array(''=>'请选择');
			foreach($files as $file)
			{
				$key = substr($file, 0, -5);
				$templates[$key] = $file;
			}
			ksort($templates);
			return $templates;
		}
	}
?>